package healthwatcher.business.factories;

import healthwatcher.business.GAEFacadeAdapter;
import healthwatcher.business.HealthWatcherFacade;
import healthwatcher.view.GAEServletAdapter;
import healthwatcher.view.IFacade;

import java.io.IOException;
import java.rmi.RemoteException;

import lib.exceptions.CommunicationException;
import lib.exceptions.RepositoryException;

public class GAEFacadeFactory extends AbstractFacadeFactory {
	
	
	public IFacade createClientFacade() throws CommunicationException {
		
	//	return new GAEServletAdapter();
		
		try {
			return HealthWatcherFacade.getInstance();
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (RepositoryException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	
	
	public void createServerFacade() throws CommunicationException {
		try {
			GAEFacadeAdapter.getInstance();
		} catch (Exception e) {
			throw new CommunicationException(e.getMessage());
		}
	}

}
